#!/usr/bin/python
# -*- coding:utf-8 -*-
import pandas as pd

class ExcelFinder:
    def __init__(self, data):
        self.data = data

    def findData(self,wellDepth):
        df = self.data

        dMaxList = df.loc[df['井深'] <= wellDepth]
        if not dMaxList.empty:
            maxRow = dMaxList.loc[dMaxList['井深'].idxmax()]
        else:
            maxRow = None

        dMinList = df.loc[df['井深'] >= wellDepth]
        if not dMinList.empty:
            minRow = dMinList.loc[dMinList['井深'].idxmin()]
        else:
            minRow = None


        return maxRow, minRow

